<pre class="docs-method-signature"><code>link.source()</code></pre>
<p>Return a shallow copy of the <code>source</code> property of the link.</p>

<p>If the beginning of the link is connected to an element, an object in the format <code>{ id: elementID }</code> is returned. If the beginning of the link is specified as a point instead (the link is <q>pinned</q> to the paper at that point), an object in the format <code>{ x: sourceX, y: sourceY }</code> is returned. Furthermore, any additional arguments of the source are returned alongside those properties.</p>

<p>If you need to be sure that a Cell is returned (and not a Point), use the <code>link.getSourceCell</code> <a href="#dia.Link.prototype.getSourceCell">function</a> instead. If you need an Element, use the <code>link.getSourceElement</code> <a href="#dia.Link.prototype.getSourceElement">function</a>.</p>


<pre class="docs-method-signature"><code>link.source(source [, opt])</code></pre>
<p>Set the <code>source</code> of the link.</p>

<p>If the link is to be connected to an element, send an object in the format <code>{ id: element.id }</code> (or a <code>joint.dia.Element</code> object). If the link is to be pinned to the paper, send an object in the format <code>{ x: sourceX, y: sourceY }</code> (or a <code>g.Point</code> object).</p>

<pre><code>link.source(rect);
link.source({ id: rect.id });

link.source(new g.Point(100, 100));
link.source({ x: 100, y: 100 });</code></pre>

<p>Additional options may by provided to further specify the behavior of link at the source:</p>

<pre><code>link.source(rect, {
    selector: 'body',
    anchor: {
        name: 'bottomLeft',
        args: {
            dx: 20,
            dy: -10
        }
    }
});</code></pre>

<p>More information can be found in <a href="#dia.Link.geometry.source">link source documentation</a>.
